#!/bin/sh

cd $(dirname $0)
cd ..
BASE_DIR=$(pwd)

echo "Pulling updated."

git pull origin

echo "Starting update depends."

yarn

echo "Starting build."

yarn build

echo "Starting postbuild."

yarn postbuild

cd $BASE_DIR/server

echo "Starting update server depends."

yarn

echo "Starting restart pm2."

yarn start

echo "Completed."